package com.woniuxy.controller;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.woniuxy.pojo.Trainrecord;
import com.woniuxy.service.TrainrecordService;

@Controller
@RequestMapping("/trainrecord")
public class TrainrecordController {

	@Autowired
	private TrainrecordService trainrecordService;
	
	@RequestMapping("/list")
	public String getAllPlan(Model model) {
		
		
		List<Trainrecord> l = trainrecordService.getAllTrainrecord();
		model.addAttribute("trainrecord",l);
		
		return "forward:/train/record.jsp";
	}
	
	@RequestMapping("/addAvgIspass")
	public String addAvgIspass(Integer sid,Integer pid,Model model) {
		
		model.addAttribute("sid",sid);
		model.addAttribute("pid",pid);
		System.out.println("++++++++++++++");
		System.out.println(sid);
		System.out.println(pid);
		trainrecordService.addAvgIspass(sid, pid);
		return "forward:/trainrecord/list";
	}
}
